﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace _2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numbers = new int[10];
            int sum = 0;
            double avg;

            for (int i = 0; i < numbers.Length; i++)
            {
                Write("请输入数组arr的第{0}个元素的值：", i);
                string value = ReadLine();
                while (!int.TryParse(value, out numbers[i]))
                {
                    if (value == "")
                    {
                        WriteLine("不可输入空字符串，请重新输入！");
                    }
                    else
                    {
                        WriteLine("非法输入，请重新输入！");
                    }
                    Write("请输入数组arr的第{0}个元素的值：", i);
                    value = ReadLine();
                }
                sum += numbers[i];
            }
            WriteLine();
            avg = (double)sum / 10;
            WriteLine("数组arr的平均值为：{0:F4}", avg);
            ReadKey(true);
        }
    }
}
